/*
fic1.c by TSherry(?......!)
2018.1.13 2:08 PM
*/
#include<stdio.h>
#include"masterdata.h"

int conrol1(void);
int ope1(float k,float b);

int main()
{
	printf("一次函数因变量运算器.\n");
	
	conrol1();
	return 0;
}

int conrol1(void)
{
	cout<<"首先输入运算次数按照该次数运算随后程序退出"<<endl;
	float k,b;
	int i;
	int times;
	cin>>times;
	cout<<"请输入一次项系数与常数项."<<endl;
	cin>>k>>b;
	if(k==0.0)
	{
		cout<<"ERROR.\n";
	}
	else
	{
	
		for(i=0;i<times;i++)
		{
			ope1(k,b);
		}

	}

	
	return 0;
}

int ope1(float k,float b)
{
	float y,x;
	cout<<"输入自变量:\b\b";
	scanf("%f",&x);
	y=k*x+b;
	cout<<"自变量:"<<y<<endl;
	if(k>0)
	{
		cout<<"\033[1;36m 该函数图像为从左到右上升趋势的直线.";
		printf("与Y轴交点为 (0,%f).\033\[0m\n",b);
		whiteword();
	}
	else
	{
		printf("\033[1;36m该函数图像为从左到右上升趋势的直线.");
		printf("与Y轴交点为(0,%f).\033\[0m\n",b);
		whiteword();
	}
	if(k>0&&b==0)
	{
		cout<<"图像过第一，三象限.\n";
	 } else if(k>0&&b>0)
	 {
	 	cout<<"图像过第一，二，三象限.\n";
	 }else if(k>0&&b<0)
	 {
	 	cout<<"图像过第一，三，四象限.\n";
	 }else if(b>0)
	 {
	 	cout<<"图像过第一，二，四象限.\n";
	 }else if(b==0)
	 {
	 	cout<<"图像过第二，四象限.\n";
	 }else 
	 {
	 	cout<<"图像过第二，三，四象限.\n";
	 }

	float root;
	root=-1*b/k;
	//printf("

	return 0;
}
	

